package myschool.test3;

import myschool.dao.StudentDao;
import myschool.entity.Student;
import myschool.util.MybatisUtil;
import org.apache.ibatis.session.SqlSession;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.List;

/**
 * @author oldliu
 * @since 1.0
 */
public class QuerySTu {
    public static void main(String[] args) throws ParseException {
        //String ->Date
        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
        SqlSession s = MybatisUtil.get();
        StudentDao mapper = s.getMapper(StudentDao.class);

        List<Student> list = mapper.search1("文", null, df.parse("2017-1-1"), df.parse("2019-12-1"), 1, 10);
        int size = mapper.search1Total("文", null, df.parse("2017-1-1"), df.parse("2019-12-1"));

        // List<Student> list = mapper.search1("文", null, df.parse("2018-1-1"), null);
        //List<Student> list = mapper.search1("", null, null, null);
        System.out.println("总数：" + size);
        list.forEach(System.out::println);
        MybatisUtil.close(s);


    }
}
